#include <ostream>
enum class Month
{
    Jan = 1,
    Feb,
    Mar,
    Apr,
    May,
    Jun,
    Jul,
    Aug,
    Sep,
    Oct,
    Nov,
    Dec
};

class Data
{
private:
    bool Is_Valid();
    bool Is_Leap_Year();

    friend std::ostream &operator<<(std::ostream &out, const Data &dt);

public:
    class Invalid_Data
    {
    };
    Data() {}
    Data(int year, Month mon, int day);
    void add_day();

private:
    int _year{1978};
    Month _mon{Month::Jun};
    int _day{25};
};

Data::Data(int year, Month mon, int day) : _year{year}, _mon{mon}, _day{day}
{
    if (!Is_Valid())
    {
        throw Invalid_Data{};
    }
}

bool Data::Is_Valid()
{
    if (_mon < Month::Jan || _mon > Month::Dec)
    {
        return false;
    }
    if (Is_Leap_Year())
    {
        if (_day < 1 || _day > 29)
        {
            return false;
        }
    }
    else
    {
        if (_day < 1 || _day > 31)
        {
            return false;
        }
    }

    return true;
}

bool Data::Is_Leap_Year()
{
    if ((_year % 100 != 0 && _year % 4 == 0) || (_year % 100 == 0 && _year % 400 == 0))
    {
        return true;
    }
    return false;
}

void Data::add_day()
{
    _day += 1;
}

std::ostream &operator<<(std::ostream &out, const Data &dt)
{
    out << dt._year << "-" << static_cast<int>(dt._mon) << "-" << dt._day;
    return out;
}